<?php

/**
 * Flash Widget class
 *
 * @author Julot
 * @since Wednesday, May 30, 2012. 08:18 PM
 */
class FlashWidget extends CWidget {

	public function run() {
		$flashMessages = Yii::app()->user->getFlashes();
		if ($flashMessages) {
//			Yii::app()->clientScript->registerScript(
//				'myHideEffect',
//				'$(".flash").animate({opacity: 0.9}, 3500).fadeOut("slow");',
//				CClientScript::POS_READY
//			);

			foreach ($flashMessages as $key=>$message) {
				echo '<div class="flash-' . $key . ' round">';
				echo $message;
				echo "</div>\n";
			}
		}
	}

}
